﻿@{
  Layout = "~/Views/Shared/_ContentPage.cshtml";
  ViewBag.Title = "User Guide - WorldWide Telescope";
}

@section leftnav {
  @Html.Partial("~/Views/Learn/LeftNav.cshtml")
}

<script>
$(function () {
  $.ajax({
    //type:'GET',
    //url: '/Models/wwtguides.xml',
    url: 'https://raw.githubusercontent.com/WorldWideTelescope/wwt-documentation/master/wwtguides.xml',
    success: function (x, status, xhr) {
      var tmpl = $('.guide-row.hide'), track, row, populate = function (sel, node) {
        row.find(sel).html(track.find(node).text());
      }

      $(x).find('Guide').each(function (i, item) {
        track = $(this);
        row = tmpl.clone(true);
        row.removeClass('hide');
        var title = track.find('Title').text();
        row.find('a.guide-link-pdf').attr('href',
        'https:' + '@Model.ContentDir/assets/guides/' +
        track.find('Filename').text() + '.pdf');
        row.find('a.guide-link-mobi').attr('href',
        'https:' + '@Model.ContentDir/assets/guides/' +
        track.find('Filename').text() + '.mobi');
        row.find('a.guide-link-epub').attr('href',
        'https:' + '@Model.ContentDir/assets/guides/' +
        track.find('Filename').text() + '.epub');
        row.find('a.guide-link-gitbook').attr('href',
        track.find('URL').text());
        row.find('a.guide-link-repo').attr('href',
        track.find('Repository').text());
        row.find('a.guide-createdbyurl').attr('href',
        track.find('CreatedByURL').text());
        row.find('a.guide-maintainedbyurl').attr('href',
        track.find('MaintainedByURL').text());
        populate('.guide-title', 'Title');
        populate('.guide-filename', 'Filepath');
        populate('.guide-createdby', 'CreatedBy');
        populate('.guide-description', 'Description');
        populate('.guide-audience', 'Audience');
        populate('.guide-repository', 'Repository');
        populate('.guide-maintainedby', 'MaintainedBy');
        populate('.guide-url', 'URL');
        $('#guidesTarget').append(row);
      });
    }
  });

  $('#guideAssets .guide-links').each(function () {
    $(this).text($(this).text().replace(/_/g, ' '));
  });
});
</script>

<h2>User Guides</h2>

<p>Below are our "living" written guides for users interested in learning more
about WWT. The WorldWide Telescope Ambassadors program also has an
excellent <a href="https://wwtambassadors.org/resources">resource page for
learning WWT.</a> </p>

<p>Besides reading, you can find help on YouTube, especially
on <a href="https://www.youtube.com/channel/UCjx-BjxGX6vvxALi9ziBfjA">our</a>
and <a href="https://www.youtube.com/user/WWTAmbassadors">WWTA's</a> YouTube
channels.</p>

<p>If you're having trouble, please <a href="/Support/IssuesAndBugs">let us
    know.</a></p>

<br />

<div class="tab-pane" id="models" style="padding-bottom:20px;">
  <div class="tab-pane active" id="guides">
    <div class="row" style="margin:18px 0 3px">
      <div class="col-md-4"><strong>Title</strong></div>
      <div class="col-md-5"><strong>Description</strong></div>
      <div class="col-md-3"><strong>Links to the Guide</strong></div>
    </div>

    <div class="guide-row hide">
      <hr />
      <div class="row" id="guideAssets">
        <div class="col-md-4">
          <strong>
            <span class=guide-title></span>
          </strong>
          <br /> Created by: <a class="guide-createdbyurl iblock">
            <i class="fa fa-github-alt"></i>
            <span class=guide-createdby></span>
          </a><br /> Maintained by: <a class="guide-maintainedbyurl iblock">
            <i class="fa fa-github-alt"></i>
            <span class=guide-maintainedby></span>
          </a><br />
        </div>
        <div class="col-md-5">
          <span class=guide-description></span> <br />
          <strong>Target Audience:</strong> <span class=guide-audience></span>
        </div>
        <div class="col-md-3">
          <a class="guide-link-gitbook iblock">
            <i class="fa fa-external-link"></i> Read Online</a><br />
          <a class="guide-link-pdf iblock">
            <i class="fa fa-file-pdf-o"></i>
            <span class=guide-filepath></span> PDF document
          </a><br />
          <a class="guide-link-epub iblock">
            <i class="fa fa-file-text"></i>
            <span class=guide-filepath></span> eBook (.epub)
          </a><br />
          <a class="guide-link-mobi iblock">
            <i class="fa fa-file-text-o"></i>
            <span class=guide-filepath></span> eBook (.mobi)
          </a><br />
          <a class="guide-link-repo iblock">
            <i class="fa fa-github"></i> GitHub Repository
          </a><br />
        </div>
      </div>
    </div>

    <div id="guidesTarget"></div>
  </div>
</div>
